package com.kongfanyu.springcloud.controller;

import com.kongfanyu.springcloud.entities.CommonResult;
import com.kongfanyu.springcloud.service.StorageService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * Copyright (C), 2018-2020
 * FileName: OrderController
 * Author:   kongfanyu
 * Date:     2020/9/6 13:32
 */
@Slf4j
@RestController
public class StorageController {
    @Resource
    private StorageService storageService;

    @PostMapping("/storage/decrease")
    public CommonResult decrease(Integer productId, Integer count){
        log.info("调用库存微服务StorageController控制器方法: productId={},count={}",productId, count);
        storageService.decrease(productId,count);
        return new CommonResult(200,"扣减库存成功");
    }

}
